package com.ohimy.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 资讯类别封装类
 * 
 * @author Tony Tang
 * @version 1.0
 */
@Entity
@MappedSuperclass
@Table(name = "ohimy_info_sort")
public class InfoSort implements Serializable {

	private static final long serialVersionUID = 1L;

	private long id;

	private String name; // 类别名

	private String template;// 显示模板

	private Date created; // 发布时间

	private List<InfoSubSort> infoSubSort;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name = "_name", length = 16)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "_template", length = 32)
	public String getTemplate() {
		return template;
	}

	public void setTemplate(String template) {
		this.template = template;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "_created", updatable = false)
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@OneToMany(mappedBy = "infoSort", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	public List<InfoSubSort> getInfoSubSort() {
		return infoSubSort;
	}

	public void setInfoSubSort(List<InfoSubSort> infoSubSort) {
		this.infoSubSort = infoSubSort;
	}

}
